package com.mall.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mall.entity.Goods;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

/**
 * @author ShouPeng
 * @since 2024-01-14
 * 商品mapper
 */
@Repository
@Mapper
public interface GoodsMapper extends BaseMapper<Goods> {

    /**
     * 减少库存
     * @param count
     * @param goodsId
     * @return
     */
    @Update("update mall_goods set goods_left = goods_left - #{count} where goods_id = #{goodsId}")
    boolean minusGoodsStock(Integer count,String goodsId);

}
